package com.baturu.vin.hyundai.dal.dao;

import com.baturu.vin.hyundai.dto.HyundaiKiaAssemblyDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

public interface HyundaiKiaAssemblyDAO {

    @Select("<script>" +
            "SELECT distinct bpno,imageCode,assPartsName,nonAssPartsName " +
            "FROM hyundai_assembly " +
            "WHERE bpno = #{bpno}" +
            "AND imageCode IN " +
            "<foreach item='item' index='index' collection='imageCodes' open='(' separator=',' close=')'>" +
            "#{item}" +
            "</foreach>" +
            "AND assPartsName IN  " +
            "<foreach item='item' index='index' collection='partsNames' open='(' separator=',' close=')'>" +
            "#{item}" +
            "</foreach>" +
            "</script>")
    List<HyundaiKiaAssemblyDTO> queryPartsAssembly(@Param("imageCodes") Set<String> imageCodes, @Param("partsNames") Set<String> partsNames, @Param("bpno") String bpno);
}